﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public partial class UIAE05 : ViewBase
    {
        public override void ManageCommand(object sender, RoutedEventArgs e)
        {
            if (!IsManage)
            {
                VICC_WFEVENTS.SVWF.AM02(this.RUNID);
            }

            base.ManageCommand(sender, e);
        }
        public void ResetSeq(object sender, RoutedEventArgs e)
        {
            if (!TMV.IsITX)
            {
                return;
            } 
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            base.Window_Loaded(sender, e);
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if (dwMaster == null)
            {
                KEY = "";

            }
            else
            {
                KEY = TMV.MEVAGANG + TMV.MEVMTYP + TMV.MEVMNRKRS + TMV.MEVMLFDNR +TMV.MEVMPOS +TMV.MEVEVARHNR  +TMV.MEVEVARUNR  +TMV.MEVMODNR + TMV.MEVEINSTNR;
            }
        }
    }
    public partial class UIAE05
    {
        public VMEVAR TMV
        {
            get
            {
                return (VMEVAR)MV;
            }
        }

        #region ==MACHINEID===========
        public static readonly DependencyProperty MACHINEIDProperty = DependencyProperty.Register("MACHINEID",
            typeof(string), typeof(UIAE05),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnMACHINEIDChanged));
        public string MACHINEID
        {
            get
            {
                return (string)GetValue(MACHINEIDProperty);
            }
            set
            {
                SetValue(MACHINEIDProperty, value);
                OnMACHINEIDChg(value);
            }
        }
        private static void OnMACHINEIDChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAE05;
            if (src != null)
            {
                src.MACHINEID = (string)e.NewValue;
            }
        }
        public virtual void OnMACHINEIDChg(string value)
        { }
        #endregion
        #region ==IsByAM===========
        public static readonly DependencyProperty IsByAMProperty = DependencyProperty.Register("IsByAM",
            typeof(bool), typeof(UIAE05),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsByAMChanged));
        public bool IsByAM
        {
            get
            {
                return (bool)GetValue(IsByAMProperty);
            }
            set
            {
                SetValue(IsByAMProperty, value);
                OnIsByAMChg();
            }
        }
        private static void OnIsByAMChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAE05;
            if (src != null)
            {
                src.IsByAM = (bool)e.NewValue;
            }
        }
        public virtual void OnIsByAMChg()
        { }
        #endregion
    }
}
